﻿#include "Generation/Piecemeal/Vec.h"

TOWERDEFENCE_API const FVec FVec::DefaultVec(-99999,-99999);

FVec::FVec()
{
}

FVec::FVec(int _x, int _y)
{
	this->x = _x;
	this->y = _y;
}

void FVec::Set(int _x, int _y)
{
	this->x = _x;
	this->y = _y;
}

FORCEINLINE FVec FVec::operator+(const FVec& other) const
{
	return FVec(this->x + other.x, this->y + other.y);
}

FORCEINLINE FVec FVec::operator+(const FDirection& other) const
{
	return FVec(this->x + other.x, this->y + other.y);
}

bool FVec::operator==(const FVec& other) const
{
	if (this->x == other.x && this->y == other.y)
	{
		return true;
	}
	return false;
}

TArray<FVec> FVec::cardinalNeighbors()
{
	TArray<FVec> result;

	for (int32 i = 0; i < FDirection::cardinal.Num(); ++i)
	{
		result.Add(*this + FDirection::cardinal[i]);
	}
	
	return result;
}

FVec FVec::offset(int _x, int _y)
{
	return FVec(this->x + _x, this->y + _y); 
}